<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>


    <style>
        span {
            text-align: center;
            width: 50px;
            height: 50px;
            font-size: 25px;
            color: blueviolet;
        }
        img {
            width: 200px;
            height: 200px;
            display: none;
        }

    </style>

    <script>
        window.onload = function () {
            var oBtn = document.getElementsByTagName("span")[0];

            var oLay = document.getElementById("overlay");

            var aBox = document.getElementById("box");

            var aImg = document.getElementsByTagName("img")[0]
            // var oClose = document.getElementById("close");
            oBtn.onclick = function () {
                aBox.style.display = "block";
                aImg.style.display = "block";
            }
            aImg.onclick = function () {
                aBox.style.display = "none";
                oLay.style.display = "none";
            }
        }
    </script>
</head>

<body>
<span>点我</span>


    <div class="box">

    </div>
    <div id="overlay"></div>
    <div id="box">
        <img src="./小丸子.gif" alt="">

    </div>
</body>

</html>